package com.define.ssh.dao.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.define.ssh.dao.InterfaceIpDao;
import com.define.ssh.model.InterfaceIp;


public class InterfaceIpDaoImpl extends BaseDaoImpl<InterfaceIp, Integer> implements
InterfaceIpDao {

	@Override
	@Transactional
	public HashMap<String , List<InterfaceIp>>  appData() {
		final List<InterfaceIp> list=getAllList();
		HashMap<String , List<InterfaceIp>> hm=new HashMap<String, List<InterfaceIp>>();
		List<InterfaceIp> iplist;
		for(InterfaceIp ii:list){
			if(hm.containsKey(ii.getCommonid())){
				iplist=hm.get(ii.getCommonid());
				iplist.add(ii);
			}else
			{
				 iplist=new ArrayList<InterfaceIp>();
				 iplist.add(ii); 
			}
			hm.put(ii.getCommonid(), iplist);
		}
		return hm;
	}

}